#pragma once
#include "SDL.h"
#include <iostream>
#include <map>
#include <vector>

class App;

typedef void (App::* event_handler)(SDL_Event* e);

class App
{
protected:
	std::string title;
	SDL_Window* mWindow;
	SDL_Renderer* mRenderer;
	SDL_Event* e;
	std::map<int, std::vector<event_handler>> event_tables;
	bool quit;
	int width;
	int height;
	virtual void init();
	void destroy();
	virtual void tick();
public:
	enum EventType
	{
		EVENT_MOUSE,
		EVENT_KEY
	};
	App();
	App(const char* title);
	~App();
	void mainLoop();
};
